package other

import (
	"go-gin-api/app/model"
	"go-gin-api/app/model/github"
	"go-gin-api/app/util"

	"github.com/gin-gonic/gin"
)

// GetGitHub 获取开源项目列表
func GetGitHub(c *gin.Context) *util.Response {
	result := make([]*github.Github, 0)
	if err := model.DB.Find(&result).Error; err != nil {
		return &util.Response{
			Code:    200,
			Message: "failed",
			Data:    "查询失败!",
		}
	}
	return &util.Response{
		Code:    200,
		Message: "success",
		Data:    result,
	}
}
